/*
*
* SysAuthorityMapper.java
* Copyright(C) 2017-2020 fendo公司
* @date 2018-05-27
*/
package com.mass.core.sys.authority.dao;

import com.mass.core.sys.authority.model.SysAuthority;
import com.mass.core.sys.authority.model.SysAuthorityExample;
import com.mass.core.sys.menu.model.SysMenu;
import com.mass.core.sys.metadata.model.SysMetadata;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface SysAuthorityMapper {

    /**
     * 批量添加
     * @param authorityList
     * @return
     */
    int insertByBatch(@Param("authorityList") List<SysAuthority> authorityList);


	/**
	 * 
	* @Title: querySysMenu
	* @Description: 查询用户权限  
	* @param userId 用户id
	* @param roleOrUserId 角色id 0或null 为所有权限
	* @param parentId 菜单父级id 0为最高级菜单
	* @return List<SysMenuTemp> 返回类型   
	* @throws
	 */
	List<SysMenu> querySysMenu(
			@Param("userId") Long userId,
			@Param("roleOrUserId") Long roleOrUserId,
			@Param("parentId") Long parentId);
	
	
	/**
	 * 
	* @Title: querySysMenuByMenuId
	* @Description: 系统用户ID，菜单（ID）/菜单编码  查询权限
	* @param menuId
	* @param roleOrUserId  角色id 0或null 为所有权限
	* @param userId
	* @return List<SysMetadata> 资源
	* @throws
	 */
	List<SysMetadata> querySysMetadataByMenuId(@Param("menuId")Long menuId,@Param("roleOrUserId")Integer roleOrUserId,@Param("userId")Long userId);
	
	/**
	 * 
	* @Title: querySysMenuByMenuId
	* @Description: 判断菜单是否有权限
	* @param userId
	* @param menuId
	* @return List<SysMenu> 返回类型   
	* @throws
	 */
	List<SysMenu> querySysMenuByMenuId(@Param("userId") Long userId,@Param("menuId")Long menuId);
	
	
    /**
     *
     * @mbg.generated
     */
    long countByExample(SysAuthorityExample example);

    /**
     *
     * @mbg.generated
     */
    int deleteByExample(SysAuthorityExample example);

    /**
     *
     * @mbg.generated
     */
    int deleteByPrimaryKey(Long id);

    /**
     *
     * @mbg.generated
     */
    int insert(SysAuthority record);

    /**
     *
     * @mbg.generated
     */
    int insertSelective(SysAuthority record);

    /**
     *
     * @mbg.generated
     */
    List<SysAuthority> selectByExample(SysAuthorityExample example);

    /**
     *
     * @mbg.generated
     */
    SysAuthority selectByPrimaryKey(Long id);

    /**
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") SysAuthority record, @Param("example") SysAuthorityExample example);

    /**
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") SysAuthority record, @Param("example") SysAuthorityExample example);

    /**
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(SysAuthority record);

    /**
     *
     * @mbg.generated
     */
    int updateByPrimaryKey(SysAuthority record);
}